package com.example.play.controller;






import com.example.play.entity.Food;
import com.example.play.entity.Scenic;
import com.example.play.service.ScenicService;
import com.api.core.result.JsonResponse;
import com.api.core.result.PageView;
import com.example.play.request.ScenicPageReq;
import com.example.play.request.ScenicReq;
import com.example.play.service.ScenicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import javax.annotation.Resource;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
/**
 * 景点(Scenic)表控制层
 *
 * @author makejava
 * @since 2022-02-26 13:44:49
 */
@Api(tags = "景点(Scenic)")
@RestController
@RequestMapping("scenic")
@Slf4j
public class ScenicController {
    /**
     * 服务对象
     */
    @Resource
    private ScenicService scenicService;
 
    @PostMapping("/addScenic")
    @ApiModelProperty("发布景点 ")
    public JsonResponse addScenic(@RequestBody ScenicReq scenicReq) {

        return JsonResponse.success (scenicService.addScenic (scenicReq));
    }
    @PostMapping("/updateScenic")
    @ApiModelProperty("删除美食 ")
    public JsonResponse updateScenic(@RequestBody Scenic scenic) {

        return JsonResponse.success (scenicService.update (scenic));
    }
    @PostMapping("/findScenicList")
    @ApiModelProperty("查询景点 列表")
    public JsonResponse<PageView<Scenic>> findScenicList(@RequestBody ScenicPageReq scenicPageReq) {

       return JsonResponse.success ( scenicService.findScenicList (scenicPageReq));
                
    }

    @GetMapping("/getScenicById")
    @ApiModelProperty("查询景点 详情")
    public JsonResponse getScenicById(@RequestParam Integer scenicId) {

        return JsonResponse.success (scenicService.getScenicById (scenicId));
    }

    @GetMapping("/deleteScenic")
    @ApiModelProperty("删除景点 ")
    public JsonResponse deleteScenic(@RequestParam Integer scenicId) {

        return JsonResponse.success (scenicService.deleteScenic (scenicId));
    }
}
